<template>
  <div>
    <el-dialog
      :title="title"
      :visible.sync="open"
      :before-close="cancel"
      width="600px"
      append-to-body
    >
      <el-form ref="form" :model="form" :rules="rules" class="dialog-form">
        <el-form-item label="接入点名称" prop="userName">
          <el-input v-model="form.userName" placeholder="请输入接入点名称" />
        </el-form-item>

        <el-form-item label="描述" prop="remark">
          <el-input v-model="form.remark" type="textarea" placeholder="请输入描述" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
export default {
  props: {
    form: {
      type: Object,
      default: () => {},
    },
    open: {
      type: Boolean,
      default: false,
    },
    title: {
      type: String,
      default: "",
    },
  },
  data() {
    return {
      rules: {
        userName: [{ required: true, trigger: "blur", message: "接入点名称不能为空" }],
      },
    };
  },
  methods: {
    cancel() {
      this.$emit("cancel");
    },
    submitForm() {
      this.$emit("submitForm");
    },
    resetFormFun() {
      this.resetForm("form");
    },
  },
};
</script>

<style scoped lang="scss"></style>
